<?php
require($_SERVER['DOCUMENT_ROOT'].'/wordpress/wp-blog-header.php' );

$METHOD = $_POST;

function processRequest($data)
{
	global $wpdb;
	$action = strtolower($data['action']);
	
	if(!strcmp($action,'mostrarasistentes'))
	{
		$query = "SELECT wp_users.ID,wp_users.user_nicename FROM `cau_event_participants` JOIN `wp_users` ON cau_event_participants.id_user = wp_users.ID AND cau_event_participants.id_evento = ".$data['id'];
		$asistentes = $wpdb->get_results($query);
		if($wpdb->num_rows<=0)
		{
			?>
			<html>
			<body>No hay asistentes</body>
			</html>			
			<?php
			return;
		}
		?>
		<html>
			<head>
				<link type="text/css" rel="stylesheet" href=<?php get_cau_file_path("ver-asistentes.css") ?> >
			</head>
			<body>
				<table class="asistente-table">
				<?php
				foreach($asistentes as $asistente)
				{
				?>
					<tr class="asistente-tr">
						<td class="asistente-avatar"><?php echo bp_core_fetch_avatar( 'item_id='.$asistente->ID) ?></td>
						<td class="asistente"><?php echo $asistente->user_nicename?></td>
					</tr>
				<?php
				}
				?>
				</table>
			<body>
		</html>
		<?php
	}
}

processRequest($METHOD);

?>